#!/bin/bash
HOST_INFO=root_info.txt
USER_INFO=user_info.txt

for ip in $(awk '{print $1}' $HOST_INFO)
do
    user=$(awk -v I="$ip" 'I==$1{print $2}' $HOST_INFO)
    port=$(awk -v I="$ip" 'I==$1{print $3}' $HOST_INFO)
    pass=$(awk -v I="$ip" 'I==$1{print $4}' $HOST_INFO)

    for name in $(awk '{print $1}' $USER_INFO)
    do
        upass=$(awk -v I="$name" 'I==$1{print $2}' $USER_INFO)
        expect _action.sh $ip $user $port $pass $name $upass
    done

done
